#include "RPCCode.h"
#include "PhysicsManager.h"

extern PhysicsManager PhysMan;
//extern CFPSDetector FPSMan;
extern PerfMonData g_PerfMonData;

extern HANDLE hPhysManSignalUp;
extern HANDLE hPhysManSignalDown;

void RemoteCall_Update(
		PerfMonData * PerfMon){
	for(int i(0); i<9; i++){

		PerfMon->cpu_usage[i] = g_PerfMonData.cpu_usage[i];
	}
	PerfMon->cur_fps = g_PerfMonData.cur_fps;
	PerfMon->num_balls = g_PerfMonData.num_balls;

	if(PerfMon->upd_dir > 0){
		SetEvent(hPhysManSignalUp);

	}
	else if(PerfMon->upd_dir < 0){
		SetEvent(hPhysManSignalDown);

	}
}

// Naive security callback.
RPC_STATUS CALLBACK SecurityCallback(RPC_IF_HANDLE /*hInterface*/, void* /*pBindingHandle*/)
{
    return RPC_S_OK; // Always allow anyone.
}

// Memory allocation function for RPC.
// The runtime uses these two functions for allocating/deallocating
// enough memory to pass the string to the server.
void* __RPC_USER midl_user_allocate(size_t size)
{
    return malloc(size);
}

// Memory deallocation function for RPC.
void __RPC_USER midl_user_free(void* p)
{
    free(p);
}